//
//  MarketViewController.m
//  nuoee_krypto
//
//  Created by Mac on 2018/5/30.
//  Copyright © 2018年 nuoee. All rights reserved.
//

#import "MarketViewController.h"
#import "ParentCoinMarketViewController.h"
#import "ExchangeMarketViewController.h"
#import "HistoryAndCategorySearchVC.h"

@interface MarketViewController ()


@end

@implementation MarketViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self createUI];
}

- (instancetype)init{
    if (self == [super init]) {
        
        self.scrollEnable = NO;
    }
    return self;
}

#pragma mark - action
- (void)searchTouch{
    HistoryAndCategorySearchVC *searchVC = [[HistoryAndCategorySearchVC alloc] init];
    [self.navigationController presentViewController:searchVC animated:YES completion:nil];
}

#pragma mark - UI
- (void)createUI{
    
    self.title = @"快比特";
    
    UIBarButtonItem *searchItem = [[UIBarButtonItem alloc] initWithImage:ImageName(@"search_nav") style:UIBarButtonItemStylePlain target:self action:@selector(searchTouch)];
    self.navigationItem.rightBarButtonItem = searchItem;
}

#pragma mark - datasource
- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController{
    return 2;
}

- (NSInteger)numbersOfTitlesInMenuView:(WMMenuView *)menu{
    return 2;
}

- (UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index{
    
    switch (index) {
        case 0:
        {
            ParentCoinMarketViewController *coinVC = [[ParentCoinMarketViewController alloc]init];
            return coinVC;
        }
            break;
        case 1:
        {
            ExchangeMarketViewController *exchangeVC = [[ExchangeMarketViewController alloc]init];
            return exchangeVC;
        }
            break;
    }
    
    return nil;
}

- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index {
    
    switch (index) {
        case 0:
        {
            return @"币行情";
        }
            break;
        case 1:
        {
            return @"交易所行情";
        }
            break;
    }
    
    return nil;
}

//当前所在控制器
- (void)pageController:(WMPageController *)pageController willEnterViewController:(__kindof UIViewController *)viewController withInfo:(NSDictionary *)info{
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
